import type { HTMLAttributes } from "@vue/runtime-dom";

type Icon = "home" | "smile";

const ICON_TO_EMOJI: Record<Icon, string> = {
  home: "🏠",
  smile: "😂",
};

type IconProps = {
  icon: Icon;
};

/**
 * 带有常见属性的组件示例。注意，vue 能够透传 {@link HTMLAttributes}.
 */
export default function Icon({ icon }: IconProps & HTMLAttributes) {
  return <span>{ICON_TO_EMOJI[icon]}</span>;
}
